package engine.skill;

import engine.ani.Animation;
import java.io.DataInputStream;
import java.util.Hashtable;
import java.util.Enumeration;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import mainpackage.Constant;
import mainpackage.MainCanvas;
import mainpackage.ResManager;
import mainpackage.Tools;

/**
 * <p>Title: 玩家技能管理类</p>
 * <p>Description: 管理各个技能的显示升级等操作</p>
 * <p>Copyright: Copyright (c) 2008</p>
 * <p>Company: </p>
 * @author sld
 * @version 1.0
 */
public class SkillManager {

    private Hashtable table;
    //索引表
    public short[] shIndexTable;
    //技能容器
    public Hashtable skillTable;
    //技能id
    public short[] shMasterSkillId;
    //技能索引
    private int shSkillIndexP;
    //技能图标
    public Image imgSkill;
    //字符串临时容器
    private StringBuffer strBuf;
    //技能说明滚动绘制y坐标
    private int iSkillInfoScrollY;
    //技能描述行数
    private short shSkillRows;
    //记录光效和职业动作的对应关系
    private int[] skillToAction = null;
    //技能动画序列ID
    private static int[] iSkillActPreActId = null;
    private String[] strSkillActPreFirstAct = null;
    private String[] strSkillActPreSECAct = null;
    public static int[] strSkillActPrePosX = null;
    public static int[] strSkillActPrePosY = null;
    public static int[] strSkillActObjPosX = null;
    public static int[] strSkillActObjPosY = null;
    public static byte[] bySkillActPreFirstActTim = null;
    //玩家职业技能
    public static byte[] bySkillActJobActTim = null;
    public static final int iSkillActJobFlareNums = 17;
    public static final int iSkillActFlareNums = 13;
    //玩家职业技能ID
    public static int[] iSkillActJobAct = null;
    private String[] strSkillActPreFirstActTim = null;
    private byte bySkillType = -1;
    //闪屏次数
    public static int iSkillFalshNums = -1;
    //震屏次数
    public static int iSkillShakeNums = -1;

    /*********************************************************************************
     *                               技能公共逻辑处理
     *********************************************************************************/
    public SkillManager() {
        this.initSkill(10, 5);
    }

    //更新技能
    public void updateSkillAni() {
        //第一
    }

    public static boolean isPlayerJobSkillType(int skillActId) {
        for (int i = 0; i < iSkillActJobAct.length; i++) {
            if (skillActId == iSkillActJobAct[i]) {
                return true;
            }
        }
//        this.iSkillId;
        return false;
    }

    public static int getSecFlarePosY(int index) {
        switch (bySkillActPreFirstActTim[index * 13]) {
            case 1:
                return 50;
            case 2:
                return 40;
            case 3:
                //脚底部
                return -20;
        }
        return 0;
    }

    /**
     * 初始化技能数据
     * @param maxnum int 辅助技能最大数量
     * @param num int 当前已记忆主技能数量
     */
    public void initSkill(int maxnum, int num) {
        this.table = new Hashtable();
        this.skillTable = new Hashtable(num);
        this.shMasterSkillId = new short[num];
        for (int i = 0; i < num; i++) {
            shMasterSkillId[i] = -1;
        }
        this.shSkillIndexP = 0;

//        this.addSkillToAction(0, Constant.PLAYER_ACTION_ID_RIGHT_SKILL_FIGHT, 3, -5, 3);
//        this.addSkillToAction(1, Constant.PLAYER_ACTION_ID_RIGHT_SRRONG_SKILL_FIGHT, 3, -5, 3);
    }
    //初始化技能和动画参照表

    public void initSkillActionPrefence(int nums) {
        this.skillToAction = new int[nums * Constant.PLAYER_SKILL_AND_ACTION];
    }

    public void addSkillActionPrefence(int nums, DataInputStream cmdData) {

//(2byte) 动画id//(变长)	前效动画//(变长)	前效播放时间//(byte)	播放次数//(byte)//后效动画//（变长）
//        后效播放时间//(byte)	播放次数//(byte)	触发震屏帧数//(byte)	震屏次数//(byte)	触发震屏帧数2
//(byte)  震屏次数2//(byte)	触发闪屏帧数//(byte)	触发闪屏次数//(byte)//触发闪屏帧数2//(byte)	触发闪屏次数2//(byte)
//        人物avatar数量//(byte)
//职业技能 轻攻击 无光效  中，重每个职业每个角色不同
        try {
            int jobSkillNums = 12;
            if (this.iSkillActPreActId == null) {
                iSkillActPreActId = new int[nums];
                strSkillActPreFirstAct = new String[nums];
                strSkillActPreSECAct = new String[nums];
                bySkillActPreFirstActTim = new byte[nums * 13];
                strSkillActPrePosX = new int[nums];
                strSkillActPrePosY = new int[nums];

                //职业技能   第几frame播放动画，第几frame闪屏（1），闪几次（1），第几frame闪屏（2），闪几次（2），第几frame闪屏（3），闪几次（3），第几frame闪屏（4），闪几次（4）--7，
                bySkillActJobActTim = new byte[]{
                    1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //0 刺客男  毒影（10202 10201）
                    1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //1 刺客女  毒影 （10202 10201）
                    1, 8, 1, 14, 1, 16, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //2 刺客男  风之刃  10301
                    3, 3, 3, 12, 1, 16, 1, 21, 1, 25, 1, 31, 2, -1, -1, -1, -1, //3 刺客女 风之刃  10301
                    5, 1, 1, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, //4 术士  纵火    40201(男女相同)
                    10, 2, 1, 5, 1, 7, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //5 术士  御火术   40301
                    3, 3, 3, 12, 1, 16, 1, 21, 1, 25, 1, 31, 2, -1, -1, -1, -1, //6 术士  御火术   40302
                    1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 1, -1, -1, -1, -1, -1, -1,//7武师  重伤     20101
                    3, 3, 3, 12, 1, 16, 1, 21, 1, 25, 1, 31, 2, -1, -1, -1, -1,//8武师  透甲     20202
                    3, 3, 3, 12, 1, 16, 1, 21, 1, 25, 1, 31, 2, -1, -1, -1, -1,//9武师  透甲     20203
                    3, 3, 3, 12, 1, 16, 1, 21, 1, 25, 1, 31, 2, -1, -1, -1, -1,//10武师  破法一击  20301
                    5, 1, 1, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1,//11武师  破法一击  20302
                    5, 1, 1, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1,};//12武师 破法一击  20303
                iSkillActJobAct = new int[]{
                    //刺客 男动画 女动画 对应的本地光效列表索引 男  女
                    10101, 438, 439, 1, 1, //刺客 毒影 213
                    10201, 438, 439, 1, 1, //刺客 毒影 213
                    10202, 438, 439, 1, 1, //刺客 毒影
                    10301, 438, 439, 1, 1, //风之刃        10301(女的ok了)
                    40101, 438, 439, 1, 1, //术士  纵火    40201
                    40201, 437, 322, 1, 1, //术士  纵火    40201
                    40202, 437, 322, 1, 1, //术士  纵火    40202
                    40203, 437, 322, 1, 1, //术士  纵火    40203
                    40301, 437, 322, 1, 1, //术士  御火术  40301
                    40302, 437, 322, 1, 1,// 术士  御火术  40302
                    20101, 438, 439, 1, 1, // 武师  透甲  20201
                    20201, 438, 439, 1, 1, // 武师  透甲  20201
                    20202, 438, 439, 1, 1, // 武师  透甲  20202
                    20203, 438, 439, 1, 1, // 武师  透甲  20202
                    20301, 438, 439, 1, 1, // 武师  破法一击  20301
                    20302, 438, 439, 1, 1, // 武师  破法一击  20302
                    20303, 438, 439, 1, 1, // 武师  破法一击  20303
                };
            }
            int j = 0;
            int index = -1;
            int avatarId = -1;
            Tools.printLog("::::::::开始了：：：：：：：：：：：" + nums);
            for (int i = 0; i < nums; i++) {
                iSkillActPreActId[i] = cmdData.readInt();
//                if( iSkillActPreActId[i] == 30005)
//                      Tools.printLog("iSkillActPreActId[i]"+"i:"+i+":"+iSkillActPreActId[i]);
                strSkillActPreFirstAct[i] = cmdData.readUTF();
                index = strSkillActPreFirstAct[i].indexOf(",");
                if (index != -1) {
                    //#if NOKIA_S40V3 || NORMAL_240_400 || MOTO || K790
//#                     strSkillActPreFirstAct[i] = strSkillActPreFirstAct[i].substring(index + 1);//substring(index + 1)
                    //#else
                    strSkillActPreFirstAct[i] = strSkillActPreFirstAct[i].substring(0, index);
                    //#endif
                }
//                strSkillActPrePosX[i] = cmdData.readInt();
//                strSkillActPrePosY[i] = cmdData.readInt();
//                bySkillActPreFirstActTim[j] = cmdData.readByte();
//                bySkillActPreFirstActTim[j + 1] = cmdData.readByte();
                strSkillActPreSECAct[i] = cmdData.readUTF();
                index = strSkillActPreSECAct[i].indexOf(",");
                if (index != -1) {
                    //#if NOKIA_S40V3 || NORMAL_240_400 || MOTO || K790
//#                     strSkillActPreSECAct[i] = strSkillActPreSECAct[i].substring(index + 1);//substring(index + 1)
                    //#else
                    strSkillActPreSECAct[i] = strSkillActPreSECAct[i].substring(0, index);
                    //#endif
                }
                bySkillActPreFirstActTim[j] = cmdData.readByte();//触发闪屏帧数3
                bySkillActPreFirstActTim[j + 1] = cmdData.readByte();//触发闪屏次数3
                bySkillActPreFirstActTim[j + 2] = cmdData.readByte();//后效释放位置.
                bySkillActPreFirstActTim[j + 3] = cmdData.readByte();//触发震屏帧数
                bySkillActPreFirstActTim[j + 4] = cmdData.readByte();//震屏次数
                bySkillActPreFirstActTim[j + 5] = cmdData.readByte();//触发震屏帧数2
                bySkillActPreFirstActTim[j + 6] = cmdData.readByte();//震屏次数2
                bySkillActPreFirstActTim[j + 7] = cmdData.readByte();//触发震屏帧数3
                bySkillActPreFirstActTim[j + 8] = cmdData.readByte();//震屏次数3
                bySkillActPreFirstActTim[j + 9] = cmdData.readByte();//触发闪屏帧数
                bySkillActPreFirstActTim[j + 10] = cmdData.readByte();//触发闪屏次数
                bySkillActPreFirstActTim[j + 11] = cmdData.readByte();//触发闪屏帧数2
                bySkillActPreFirstActTim[j + 12] = cmdData.readByte();//触发闪屏次数2
                System.out.print("|" + iSkillActPreActId[i] + "|" + strSkillActPreFirstAct[i] + "|" + strSkillActPreSECAct[i] + "|" + bySkillActPreFirstActTim[j]
                        + "|" + bySkillActPreFirstActTim[j + 1] + "|" + bySkillActPreFirstActTim[j + 2] + "|" + bySkillActPreFirstActTim[j + 3]
                        + "|" + bySkillActPreFirstActTim[j + 4] + "|" + bySkillActPreFirstActTim[j + 5] + "|" + bySkillActPreFirstActTim[j + 6]
                        + "|" + bySkillActPreFirstActTim[j + 7] + "|" + bySkillActPreFirstActTim[j + 8] + "|" + bySkillActPreFirstActTim[j + 9]
                        + "|" + bySkillActPreFirstActTim[j + 10] + "|" + bySkillActPreFirstActTim[j + 11] + "|" + bySkillActPreFirstActTim[j + 12]);
//                System.out.println("");
                j += 13;
            }
            Tools.printLog("::::::::结束了：：：：：：：：：：：");
        } catch (Exception e) {
            if (Constant.DEBUG) {
                e.printStackTrace();
            }
        }
    }

    public void readSkillActionPrefence(int nums) {
        try {
            iSkillActPreActId = new int[nums];
            strSkillActPreFirstAct = new String[nums];
            strSkillActPreSECAct = new String[nums];
            bySkillActPreFirstActTim = new byte[nums * 13];
            strSkillActPrePosX = new int[nums];
            strSkillActPrePosY = new int[nums];
            //职业技能   第几frame播放动画，第几frame闪屏（1），闪几次（1），第几frame闪屏（2），闪几次（2），第几frame闪屏（3），闪几次（3），第几frame闪屏（4），闪几次（4）--7，
            bySkillActJobActTim = new byte[]{
                1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //0 刺客男  毒影（10202 10201）
                1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //1 刺客女  毒影 （10202 10201）
                1, 8, 1, 14, 1, 16, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //2 刺客男  风之刃  10301
                3, 3, 3, 12, 1, 16, 1, 21, 1, 25, 1, 31, 2, -1, -1, -1, -1, //3 刺客女 风之刃  10301
                5, 1, 1, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, //4 术士  纵火    40201(男女相同)
                10, 2, 1, 5, 1, 7, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //5 术士  御火术   40301
                3, 3, 3, 12, 1, 16, 1, 21, 1, 25, 1, 31, 2, -1, -1, -1, -1, //6 术士  御火术   40302
                1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 1, -1, -1, -1, -1, -1, -1,//7武师  重伤     20101
                3, 3, 3, 12, 1, 16, 1, 21, 1, 25, 1, 31, 2, -1, -1, -1, -1,//8武师  透甲     20202
                3, 3, 3, 12, 1, 16, 1, 21, 1, 25, 1, 31, 2, -1, -1, -1, -1,//9武师  透甲     20203
                3, 3, 3, 12, 1, 16, 1, 21, 1, 25, 1, 31, 2, -1, -1, -1, -1,//10武师  破法一击  20301
                5, 1, 1, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1,//11武师  破法一击  20302
                5, 1, 1, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1,};//12武师 破法一击  20303
            iSkillActJobAct = new int[]{
                //刺客 男动画 女动画 对应的本地光效列表索引 男  女
                10101, 438, 439, 1, 1, //刺客 毒影 213
                10201, 438, 439, 1, 1, //刺客 毒影 213
                10202, 438, 439, 1, 1, //刺客 毒影
                10301, 438, 439, 1, 1, //风之刃        10301(女的ok了)
                40101, 438, 439, 1, 1, //术士  纵火    40201
                40201, 437, 322, 1, 1, //术士  纵火    40201
                40202, 437, 322, 1, 1, //术士  纵火    40202
                40203, 437, 322, 1, 1, //术士  纵火    40203
                40301, 437, 322, 1, 1, //术士  御火术  40301
                40302, 437, 322, 1, 1,// 术士  御火术  40302
                20101, 438, 439, 1, 1, // 武师  透甲  20201
                20201, 438, 439, 1, 1, // 武师  透甲  20201
                20202, 438, 439, 1, 1, // 武师  透甲  20202
                20203, 438, 439, 1, 1, // 武师  透甲  20202
                20301, 438, 439, 1, 1, // 武师  破法一击  20301
                20302, 438, 439, 1, 1, // 武师  破法一击  20302
                20303, 438, 439, 1, 1, // 武师  破法一击  20303
            };
            DataInputStream dis = new DataInputStream(this.getClass().getResourceAsStream(Constant.RES_SKILL_TXT));
            byte[] tempByte = null;
            int size = 0;
            while (dis.read() != -1) {
                size += 1;
            }
            dis.close();
            dis = null;
            dis = new DataInputStream(this.getClass().getResourceAsStream(Constant.RES_SKILL_TXT));
            if (Constant.DEBUG) {
                MainCanvas.addLog("readskill1");
            }
            try {
                tempByte = new byte[size];
                dis.read(tempByte);
                dis.close();
                dis = null;
            } catch (Exception e) {
                e.printStackTrace();
            }
            char chCutOff = '|';
            int j = 0;
            int index;
            if (Constant.DEBUG) {
                MainCanvas.addLog("readskill2");
            }
            for (int i = 0; i < nums * 16; i += 16) {
                iSkillActPreActId[j] = Integer.parseInt(getText(tempByte, chCutOff, i + 1));
                strSkillActPreFirstAct[j] = getText(tempByte, chCutOff, i + 2);
                index = strSkillActPreFirstAct[j].indexOf(",");
                if (index != -1) {
                    //#if NOKIA_S40V3 || NORMAL_240_400 || MOTO || K790
//#                     strSkillActPreFirstAct[i] = strSkillActPreFirstAct[i].substring(index + 1);//substring(index + 1)
                    //#else
                    strSkillActPreFirstAct[j] = strSkillActPreFirstAct[i].substring(0, index);
                    //#endif
                }
                strSkillActPreSECAct[j] = getText(tempByte, chCutOff, i + 3);
                index = strSkillActPreSECAct[j].indexOf(",");
                if (index != -1) {
                    //#if NOKIA_S40V3 || NORMAL_240_400 || MOTO || K790
//#                     strSkillActPreSECAct[i] = strSkillActPreSECAct[i].substring(index + 1);//substring(index + 1)
                    //#else
                    strSkillActPreSECAct[j] = strSkillActPreSECAct[j].substring(0, index);
                    //#endif
                }

                for (int k = 0; k < 13; k++) {
                    bySkillActPreFirstActTim[k + j * 13] = Byte.parseByte(getText(tempByte, chCutOff, i + 4 + k));
                }
//            System.out.print("|" + iSkillActPreActId[j] + "|" + strSkillActPreFirstAct[j] + "|" + strSkillActPreSECAct[j] + "|" + bySkillActPreFirstActTim[j]
//                    + "|" + bySkillActPreFirstActTim[j + 1] + "|" + bySkillActPreFirstActTim[j + 2] + "|" + bySkillActPreFirstActTim[j + 3]
//                    + "|" + bySkillActPreFirstActTim[j + 4] + "|" + bySkillActPreFirstActTim[j + 5] + "|" + bySkillActPreFirstActTim[j + 6]
//                    + "|" + bySkillActPreFirstActTim[j + 7] + "|" + bySkillActPreFirstActTim[j + 8] + "|" + bySkillActPreFirstActTim[j + 9]
//                    + "|" + bySkillActPreFirstActTim[j + 10] + "|" + bySkillActPreFirstActTim[j + 11] + "|" + bySkillActPreFirstActTim[j + 12]);
////            System.out.println("");
                j++;
            }
            if (Constant.DEBUG) {
                MainCanvas.addLog("readskill3");
            }
            tempByte = null;
        } catch (Exception e) {
            if (Constant.DEBUG) {
                MainCanvas.addLog("skillerror:" + e.getMessage());
            }
        }
    }

    public String getText(byte[] byArray, char chCutOff, int iPlace) {
        try {
            int num = 0;
            String data = null;
            for (int i = 0; i < byArray.length; i++) {
                if ((char) byArray[i] == chCutOff) {
                    num++;
                }
                if (num == iPlace) {
//                    data = new String(byArray, i + 1, (byArray.length - i - 1), "UTF-8");
                    data = new String(byArray, "UTF-8");
                    data = data.substring(i + 1, byArray.length);
                    int endPos = data.indexOf(chCutOff);
                    if (endPos != -1) {
                        data = data.substring(0, endPos);
                    }
                    break;
                }
            }
            return data;
        } catch (Exception e) {
            if (Constant.DEBUG) {
                e.printStackTrace();
                MainCanvas.addLog("异常了：" + e.getMessage());
            }
            Tools.printLog("我读文件异常了");
            return null;
        }
    }

    /*
     * 技能和动画对应
     */
    public void addSkillToAction(int index, int actId, int iFrameIndex, int posX, int posY) {
        this.skillToAction[index * 5] = actId;
        this.skillToAction[index * 5 + 1] = iFrameIndex;
        this.skillToAction[index * 5 + 2] = posX;
        this.skillToAction[index * 5 + 3] = posY;
    }

    public void addSkillAni(int index, int type, byte sex, String skillkey, int skillActId, int x, int y, int endx, int endy, byte direct) {
//        int index = getSkillIndex(skillActId);
        if (index == -1) {
            return;
        }

        Tools.printLog("技能光效key:" + skillkey + "skillActId:" + skillActId + "index" + index);
        //如果是职业技能

        if ((type == Constant.SKILL_TYPE_PLAYER_HEART) || (type == Constant.SKILL_TYPE_OTHERPLAYER_HEART)) {
            if (iSkillActJobAct[index + 1] == -1 || iSkillActJobAct[index + 1] == 0) {
                return;
            }
        } else {
            if (((Integer.parseInt(this.strSkillActPreFirstAct[index]) == -1) && (Integer.parseInt(this.strSkillActPreSECAct[index]) == -1)) || ((Integer.parseInt(this.strSkillActPreFirstAct[index]) == 0) && (Integer.parseInt(this.strSkillActPreSECAct[index]) == 0))) {
                return;
            }
        }
        //#if NOKIA_S40V3 || MOTO || K790
//#         SkillAni aSkillAni = new SkillAni(type, x, y, x, y, endx, endy, index, ((type == Constant.SKILL_TYPE_PLAYER_HEART) || (type == Constant.SKILL_TYPE_OTHERPLAYER_HEART)) ? String.valueOf(iSkillActJobAct[index + 2]) : this.strSkillActPreFirstAct[index], ((type == Constant.SKILL_TYPE_PLAYER_HEART) || (type == Constant.SKILL_TYPE_OTHERPLAYER_HEART)) ? "-1" : this.strSkillActPreSECAct[index], direct);
        //#else
        SkillAni aSkillAni = new SkillAni(type, x, y, x, y, endx, endy, index, ((type == Constant.SKILL_TYPE_PLAYER_HEART) || (type == Constant.SKILL_TYPE_OTHERPLAYER_HEART)) ? String.valueOf(iSkillActJobAct[index + 1]) : this.strSkillActPreFirstAct[index], ((type == Constant.SKILL_TYPE_PLAYER_HEART) || (type == Constant.SKILL_TYPE_OTHERPLAYER_HEART)) ? "-1" : this.strSkillActPreSECAct[index], direct);
        //#endif
        addSkillAni(aSkillAni);
    }

    public static int getSkillIndex(int skillActId) {
        int index = -1;
        for (int i = 0; i < iSkillActPreActId.length; i++) {
            if (skillActId == iSkillActPreActId[i]) {
                index = i;
                break;
            }
        }
        for (int i = 0; i < iSkillActJobAct.length; i++) {
            if (skillActId == iSkillActJobAct[i]) {
                index = i;
                break;
            }
        }
        return index;
    }

    public void addSkillAni(SkillAni aSkillAni) {
        if (aSkillAni == null) {
            return;
        }
        this.skillTable.put(String.valueOf(shSkillIndexP), aSkillAni);
        shSkillIndexP += 1;
    }

    public Animation getSkillAni(int index) {
        return ((SkillAni) this.skillTable.get(String.valueOf(index))).aniSkill;
    }

    public void drawSkillAni(Graphics g, int x, int y) {
        if (this.skillTable.isEmpty()) {
            return;
        }
        Enumeration e2 = this.skillTable.keys();
        String key = null;
        SkillAni aSkillAni = null;
        while (e2.hasMoreElements()) {
            key = (String) (e2.nextElement());
//        updateSkillAni(index);
            aSkillAni = (SkillAni) this.skillTable.get(key);
            aSkillAni.drawSkillAni(g, x, y);

            if (aSkillAni.blCanremove()) {
                this.skillTable.remove(key);
                if (this.skillTable.isEmpty()) {
//                 Tools.printLog("删除光效图片");
                    ResManager.clearRes(1022, Constant.RES_PUBLIC_ONEROOM, Constant.RES_TYPE_IMAGE);
                    ResManager.clearRes(1057, Constant.RES_PUBLIC_ONEROOM, Constant.RES_TYPE_IMAGE);
                    ResManager.clearRes(482, Constant.RES_PUBLIC_ONEROOM, Constant.RES_TYPE_IMAGE);
                    ResManager.clearRes(129, Constant.RES_PUBLIC_ONEROOM, Constant.RES_TYPE_IMAGE);
                    ResManager.clearRes(1260, Constant.RES_PUBLIC_ONEROOM, Constant.RES_TYPE_IMAGE);
                    ResManager.clearRes(73, Constant.RES_PUBLIC_ONEROOM, Constant.RES_TYPE_IMAGE);
                }
            }
            aSkillAni = null;
//                else {
//                //更新光效坐标为玩家和其它玩家坐标
////           int indexSkill = ((SkillAni) this.skillTable.get(String.valueOf(index))).iActPreIndex;
//            }

        }
    }

    public void removeAni(int i) {
        this.skillTable.remove(String.valueOf(i));
//        shSkillIndexP -= 1;
        if (shSkillIndexP < 0) {
            shSkillIndexP = 0;
        }
    }

    /**
     * 清理技能
     */
    public void clearSkill() {
        if (this.table != null) {
            this.table.clear();
        }
        this.table = null;
        if (this.skillTable != null) {
            this.skillTable.clear();
        }
        this.skillTable = null;
        this.shMasterSkillId = null;
        this.imgSkill = null;
    }

    /**
     * 取得除物理攻击外的技能总数量
     * @return short 技能数量
     */
    public int getMaxMasterSkillNum() {
        return this.shSkillIndexP;
    }

    /**
     * 根据技能id获得该技能图标
     * @param id int 技能id
     * @return Image 技能图标
     */
    //skill 0003
    public int getSkillIcon(int id) {
        for (int i = 0; i < this.shMasterSkillId.length; i++) {
            if (i == id) {
                return this.shMasterSkillId[i];
            }
        }
        return -1;
    }
}
